package operation;

import demon1.Book;
import demon1.BookList;

import java.util.Scanner;

public class FindOperation implements IOPeration{
    @Override
    public void work(BookList bookList) {
        System.out.println("查找图书");
        System.out.println("请输入你要查找的图书：");
        Scanner scanner=new Scanner(System.in);
        String Bookname=scanner.nextLine();
        int currentSzie=bookList.getUseSize();
        for (int i = 0; i < currentSzie; i++) {
            Book book=bookList.getBooks(i);
            if(book.getName().equals(Bookname)){
                System.out.println("找到了这本书");
                System.out.println(book);
                return;
            }
        }
        System.out.println("没有你要找的书");


    }
}
